package com.yzc.controller;

import com.yzc.model.vo.system.AnnouncementVo;
import com.yzc.result.Result;
import com.yzc.service.AnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/announcement")
public class HistoryAnnouncementController {

    @Autowired
    private AnnouncementService announcementService;
    @GetMapping("/acquireNewAnnouncement")
    public Result<AnnouncementVo> acquireNewAnnouncement(){
        return Result.success(announcementService.acquireNewAnnouncement());
    }

    @GetMapping("/getAllAnnouncement")
    public Result<List<AnnouncementVo>> getAllAnnouncement(){
        return Result.success(announcementService.getAllAnnouncement());
    }

    @GetMapping("/getAnnouncementContent")
    public Result<List<AnnouncementVo>> getAnnouncementContent(@RequestParam("content") String content){
        return Result.success(announcementService.getAnnouncementContent(content));
    }
}
